/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EntityBeans;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author DROWNE
 */
@Entity
@Table(name = "game")
@NamedQueries({
    @NamedQuery(name = "Game.findAll", query = "SELECT g FROM Game g"),
    @NamedQuery(name = "Game.findByIdgame", query = "SELECT g FROM Game g WHERE g.idgame = :idgame"),
    @NamedQuery(name = "Game.findByTimestampbegin", query = "SELECT g FROM Game g WHERE g.timestampbegin = :timestampbegin"),
    @NamedQuery(name = "Game.findByOwner", query = "SELECT g FROM Game g WHERE g.owner = :owner"),
    @NamedQuery(name = "Game.findByTimestampend", query = "SELECT g FROM Game g WHERE g.timestampend = :timestampend"),
    @NamedQuery(name = "Game.findByCenterlat", query = "SELECT g FROM Game g WHERE g.centerlat = :centerlat"),
    @NamedQuery(name = "Game.findByCenterlon", query = "SELECT g FROM Game g WHERE g.centerlon = :centerlon"),
    @NamedQuery(name = "Game.findByGamephase", query = "SELECT g FROM Game g WHERE g.gamephase = :gamephase")})
public class Game implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idgame")
    private Integer idgame;
    @Basic(optional = false)
    @Column(name = "timestampbegin")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timestampbegin;
    @Basic(optional = false)
    @Column(name = "owner")
    private String owner;
    @Basic(optional = false)
    @Column(name = "timestampend")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timestampend;
    @Column(name = "centerlat")
    private Integer centerlat;
    @Column(name = "centerlon")
    private Integer centerlon;
    @Column(name = "gamephase")
    private Integer gamephase;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "game")
    private Collection<Gamesession> gamesessionCollection;

    public Game() {
    }

    public Game(Integer idgame) {
        this.idgame = idgame;
    }

    public Game(Integer idgame, Date timestampbegin, String owner, Date timestampend) {
        this.idgame = idgame;
        this.timestampbegin = timestampbegin;
        this.owner = owner;
        this.timestampend = timestampend;
    }

    public Integer getIdgame() {
        return idgame;
    }

    public void setIdgame(Integer idgame) {
        this.idgame = idgame;
    }

    public Date getTimestampbegin() {
        return timestampbegin;
    }

    public void setTimestampbegin(Date timestampbegin) {
        this.timestampbegin = timestampbegin;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public Date getTimestampend() {
        return timestampend;
    }

    public void setTimestampend(Date timestampend) {
        this.timestampend = timestampend;
    }

    public Integer getCenterlat() {
        return centerlat;
    }

    public void setCenterlat(Integer centerlat) {
        this.centerlat = centerlat;
    }

    public Integer getCenterlon() {
        return centerlon;
    }

    public void setCenterlon(Integer centerlon) {
        this.centerlon = centerlon;
    }

    public Integer getGamephase() {
        return gamephase;
    }

    public void setGamephase(Integer gamephase) {
        this.gamephase = gamephase;
    }

    public Collection<Gamesession> getGamesessionCollection() {
        return gamesessionCollection;
    }

    public void setGamesessionCollection(Collection<Gamesession> gamesessionCollection) {
        this.gamesessionCollection = gamesessionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idgame != null ? idgame.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Game)) {
            return false;
        }
        Game other = (Game) object;
        if ((this.idgame == null && other.idgame != null) || (this.idgame != null && !this.idgame.equals(other.idgame))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntityBeans.Game[idgame=" + idgame + "]";
    }

}
